package com.geek.rest;

import javax.ws.rs.core.UriBuilder;


public class PathParamUriBuilderAssembler implements UriAssembler {
    @Override
    public void assembler(UriBuilder uriBuilder, AnnotatedParamMetadata metadata, Object[] args) {
        String paramName = metadata.getParamName();
        int paramIndex = metadata.getParameterIndex();
        Object paramValue = args[paramIndex];
        if (paramValue == null) { // Handle @DefaultValue
            paramValue = metadata.getDefaultValue();
        }
        uriBuilder.resolveTemplate(paramName, paramValue);
    }
}
